<?php 
$weekarr = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
$week = $weekarr[date("w")];
?>
<div id="indextry" class="indexcontentdiv">
    <div class="positiondiv">
        <table>
            <tr>
                <td class="td-left">
                    <img src="<?=base_url()?>resource/img/home_ico.png" width="21" height="17">
                    <?=$this->lang->line("Data Entry")?> > <?=$this->lang->line("Industry")?>
                </td>
                <td class="td-right">
                    <img src="<?=base_url()?>resource/img/menu2.png" width="27" height="24"><?=$this->lang->line("TodayIS")?> <?=$week?>,<?=date('M d,Y')?>
                </td>
            </tr>
        </table>
    </div>
    <span class="err"><?=validation_errors();?></span>
    <div class="list-div">
        <?php echo form_open('index/industry'); ?>
        <table class="top-table">
            <tr>
                <td><?=$this->lang->line("IndustryList")?></td>
                <td width="240" class="center"><input type="text" placeholder="<?=$this->lang->line("searchmsg")?>" 
                    name="condition" value="<?=$condition?>"/></td>
                <td width="90" class="center"><input type="submit" value="<?=$this->lang->line("Search")?>" /></td>
            </tr>
        </table>
        <?php echo form_close(); ?>
        <?php echo form_open('index/newindustry'); ?>
        <table class="list-table">
            <tr>
                <th width="50"><?=$this->lang->line("ID")?></th>
                <th><?=$this->lang->line("Industry")?></th>
                <th width="80"></th>
            </tr>
            <?php foreach ($industry as $key => $value) {?>
            <tr>
                <td><?=$value['id']?></td>
                <td><?=$value['name']?></td>
                <?php if($this->session->userdata('department') == 1){?>
                <td><a href="javascript:void(0)" class="buttona delete" candidateid="<?=$value['id']?>">
                        <img src="<?=base_url()?>resource/img/delete.png"/><?=$this->lang->line("Delete")?></a></td>
                <?php }else{?>
                <td></td>
                <?php }?>
            </tr>
            <?php }?>
            <tr>
                <td></td>
                <td><input type="text" name="industry" class="newindustryinput" /></td>
                <td>
                    <input type="submit" value="New" id="new" class="newbtn"/>
                </td>
            </tr>
        </table>
        <?php echo form_close(); ?>
    </div>
</div>
<script>
$(".delete").click(function(){
    if(confirm("Are you sure delete this industry?")){
        var id = $(this).attr("candidateid");
        var url = '<?=base_url()?>index/deleteindustry?id='+id;
        location.href=url;
    }
});
</script>